package android.gpsmessenger;

import android.app.Activity;
import android.content.Intent;
import android.widget.Toast;

public class EmailMessenger extends Messenger
{
	EmailMessenger(Activity activity)
	{
		super(activity);
	}
	
	public void send(String[] to, String subject, String message)
	{
		try 
		{
			Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
			//String[] to = new String[]{"svetanis@gmail.com"};
			emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, to);
			emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
			emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, message);
			emailIntent.setType("text/plain");
			//emailIntent.setType("message/rfc822");
			getActivity().startActivity(emailIntent);  
			//startActivity(Intent.createChooser(emailIntent, "Send mail..."));
		} 
		catch (Exception e) 
		{
			Toast.makeText(getActivity(), "Message faild, please try again later!", Toast.LENGTH_LONG).show();
			e.printStackTrace();
		}
		
		//Toast.makeText(getActivity(), "Message Sent!",Toast.LENGTH_LONG).show();
	}
	 
}
